Use g_slice instead of mem chunks.
authorMatthias Clasen <mclasen@redhat.com>
Mon, 5 Dec 2005 20:51:18 +0000 (20:51 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 5 Dec 2005 20:51:18 +0000 (20:51 +0000)
2005-12-05  Matthias Clasen  <mclasen@redhat.com>

* gdk/gdkevents.c:
* gdk/gdkcolor.c: Use g_slice instead of mem chunks.

ChangeLog
ChangeLog.pre-2-10
gdk/gdkcolor.c
gdk/gdkevents.c

index ed7e604c9688f34fc9ed15ec0b82269e9aa3d552..727b97919a14dfba4adce86b1149e6a2bea15ba0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2005-12-05  Matthias Clasen  <mclasen@redhat.com>
 
+       * gdk/gdkevents.c: 
+       * gdk/gdkcolor.c: Use g_slice instead of mem chunks.
+
        * gtk/gtktreeview.c (gtk_tree_view_key_press): Free new_event
        after sending it to the search entry.  (#323209, Crispin Flowerday)
 
index ed7e604c9688f34fc9ed15ec0b82269e9aa3d552..727b97919a14dfba4adce86b1149e6a2bea15ba0 100644 (file)
@@ -1,5 +1,8 @@
 2005-12-05  Matthias Clasen  <mclasen@redhat.com>
 
+       * gdk/gdkevents.c: 
+       * gdk/gdkcolor.c: Use g_slice instead of mem chunks.
+
        * gtk/gtktreeview.c (gtk_tree_view_key_press): Free new_event
        after sending it to the search entry.  (#323209, Crispin Flowerday)
 
index 404dd3dc8c6876a5019bc5a8660d4a9da9bc08f7..83da2cddefec7c04a54a9c23500949d38604a9c1 100644 (file)
@@ -103,8 +103,6 @@ gdk_colors_store (GdkColormap   *colormap,
   gdk_colormap_change (colormap, ncolors);
 }
 
-static GMemChunk *color_chunk;
-
 /**
  * gdk_color_copy:
  * @color: a #GdkColor.
@@ -121,13 +119,7 @@ gdk_color_copy (const GdkColor *color)
   
   g_return_val_if_fail (color != NULL, NULL);
 
-  if (color_chunk == NULL)
-    color_chunk = g_mem_chunk_new ("colors",
-                                  sizeof (GdkColor),
-                                  4096,
-                                  G_ALLOC_AND_FREE);
-
-  new_color = g_chunk_new (GdkColor, color_chunk);
+  new_color = g_slice_new (GdkColor);
   *new_color = *color;
   return new_color;
 }
@@ -142,10 +134,9 @@ gdk_color_copy (const GdkColor *color)
 void
 gdk_color_free (GdkColor *color)
 {
-  g_assert (color_chunk != NULL);
   g_return_if_fail (color != NULL);
 
-  g_mem_chunk_free (color_chunk, color);
+  g_slice_free (GdkColor, color);
 }
 
 /**
index 040ebc292f4041dc5228dfe1ca7e3f4420ff3f69..dc85f9eb9f37dc1deb0b20e60d8f117255220664 100644 (file)
@@ -255,7 +255,6 @@ gdk_event_put (GdkEvent *event)
   gdk_display_put_event (display, event);
 }
 
-static GMemChunk *event_chunk = NULL;
 static GHashTable *event_hash = NULL;
 
 /**
@@ -275,17 +274,7 @@ gdk_event_new (GdkEventType type)
   GdkEventPrivate *new_private;
   GdkEvent *new_event;
   
-  if (event_chunk == NULL)
-    {
-      event_chunk = g_mem_chunk_new ("events",
-                                    sizeof (GdkEventPrivate),
-                                    4096,
-                                    G_ALLOC_AND_FREE);
-      event_hash = g_hash_table_new (g_direct_hash, NULL);
-    }
-  
-  new_private = g_chunk_new (GdkEventPrivate, event_chunk);
-  memset (new_private, 0, sizeof (GdkEventPrivate));
+  new_private = g_slice_new0 (GdkEventPrivate);
   
   new_private->flags = 0;
   new_private->screen = NULL;
@@ -446,8 +435,6 @@ gdk_event_free (GdkEvent *event)
 {
   g_return_if_fail (event != NULL);
 
-  g_assert (event_chunk != NULL); /* paranoid */
-  
   if (event->any.window)
     g_object_unref (event->any.window);
   
@@ -498,7 +485,7 @@ gdk_event_free (GdkEvent *event)
     }
 
   g_hash_table_remove (event_hash, event);
-  g_mem_chunk_free (event_chunk, event);
+  g_slice_free (GdkEventPrivate, event);
 }
 
 /**